<template>
  <h1>test {{num}}</h1>
  <button @click="add">增加</button>
</template>

<script>
export default {
  name: 'MyConponent',
  // 声明自定义事件
  emits: ['numChange'],
  data() {
    return {
      num: 1
    }
  },
  methods: {
    add() {
      this.num ++
      this.$emit('numChange', this.num)
    }
  }
}
</script>

<style>

</style>